import java.io.*;
import java.net.*;

public class FileClient implements Runnable
{
	public void run()
	{
		Socket client = null;
		FileInputStream fin = null;

		try{
			client = new Socket("172.16.114.129", 4567);
			fin = new FileInputStream("Police.class");
			int length = fin.available();
			byte[] bytes = new byte[length];
			fin.read(bytes,0,bytes.length);
			OutputStream out = client.getOutputStream();
			DataOutputStream dout 
				= new DataOutputStream(client.getOutputStream());

			dout.writeUTF("Police.class");
			dout.writeInt(length);
			out.write(bytes);
		}catch(IOException ex){
			System.err.println(ex);
		}finally{
			try{
				client.close();
				fin.close();
			}catch(IOException ex) {
				System.err.println(ex);
			}
		}
	}

	public static void main(String[] args){
		FileClient client = new FileClient();
		Thread t = new Thread(client);
		t.start();
	}
}
